package cn.pn.project.client.order;

import cn.pn.project.config.DmConfiguration;
import cn.pn.project.client.order.fallback.OrderDetailClientFallBack;
import cn.pn.project.pojo.order.OrderDetail;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

/**
 * 订单详情Client
 */
@FeignClient(name = "pn-order-provider", configuration = DmConfiguration.class/* ,fallback = OrderDetailClientFallBack.class*/)
public interface RestOrderDetailClient {

    /**
     * 根据主键Id获取订单详情信息
     * @RequestParam childOrderId
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/getOrderDetail",method = RequestMethod.POST)
    public OrderDetail getOrderDetail(@RequestParam(value = "childOrderId") Integer childOrderId)throws Exception;


    /**
     * 多条件查询订单详情信息（分页）
     * @RequestParam param
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/getOrderDetailListByMap",method = RequestMethod.POST)
    public List<OrderDetail> getOrderDetailListByMap(@RequestParam Map<String,Object> param)throws Exception;



    /**
     * 多条件查询订单详情数量
     * @RequestParam param
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/getOrderDetailCountByMap",method = RequestMethod.POST)
    public Integer getOrderDetailCountByMap(@RequestParam Map<String,Object> param)throws Exception;

    /**
     * 新增订单详情信息
     * @RequestParam orderDetail
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/insertOrderDetail",method = RequestMethod.POST)
    public Integer insertOrderDetail(@RequestBody OrderDetail orderDetail)throws Exception;

    /**
     * 修改订单详情信息
     * @RequestParam orderDetail
     * @return
     * @throws Exception
     *
     */
    @RequestMapping(value = "/updateOrderDetail",method = RequestMethod.POST)
    public Integer updateOrderDetail(@RequestBody OrderDetail orderDetail)throws Exception;

    /**
     * 删除订单详情信息根据Id
     * @RequestParam childOrderId
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/deleteOrderDetailById",method = RequestMethod.POST)
    public Integer deleteOrderDetailById(@RequestParam(value = "childOrderId") Integer childOrderId)throws Exception;

    /**
     * 删除订单详情信息根据orderNum
     * @param orderNum
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/deleteOrderDetailByOrderNum",method = RequestMethod.POST)
    public Integer deleteOrderDetailByOrderNum(@RequestParam(value = "orderNum") String orderNum)throws Exception;


}
